<fieldset style="background:#ffffff; border-width:thin; border-style:solid; padding:10px; border-color:#CCCCCC;">
<legend style="font-size:1.0em; font-weight: bold;">Maklumat Am </legend>

<table class="classBackground" border="0" cellpadding="2" cellspacing="1" width="100%">
  <tbody>
    <tr>
      <td class="classRowLabel" align="left" valign="top" width="10"><span style="color:red;">*</span></td>
      <td width="27%" height="20" align="left" valign="top" class="classRowLabel"><strong>Kod Projek </strong></td>
      <td width="30" align="center" valign="top" class="classRowLabel"><span style="font-weight:bold">:</span></td>
      <td class="classRow"><input name="master_projek[kod_projek]" id="master_projek_kod_institusi" value="<?=$institusi->kod_institusi?>" onblur="" onchange="" onfocus="" onselect="" maxlength="10" size="12" type="text" />      </td>
    </tr>
    <tr>
      <td class="classRowLabel" align="left" valign="top" width="10"><span style="color:red;">*</span></td>
      <td width="27%" height="20" align="left" valign="top" class="classRowLabel"><strong>Projek Tag </strong></td>
      <td width="30" align="center" valign="top" class="classRowLabel"><span style="font-weight:bold">:</span></td>
      <td class="classRow"><input name="master_projek[tag]" id="nama" value="<?=$institusi->nama?>" onblur="" onchange="" onfocus="" onselect="" maxlength="100" size="50" type="text" />      </td>
    </tr>
    <tr>
      <td class="classRowLabel" align="left" valign="top" width="10"><span style="color:red;">*</span></td>
      <td width="27%" height="20" align="left" valign="top" class="classRowLabel"><strong>Nama Projek </strong></td>
      <td width="30" align="center" valign="top" class="classRowLabel"><span style="font-weight:bold">:</span></td>
      <td class="classRow"><input name="master_projek[nama]" id="nama" value="<?=$institusi->nama?>" onblur="" onchange="" onfocus="" onselect="" maxlength="100" size="50" type="text" />      </td>
    </tr>

    <tr>
      <td class="classRowLabel" align="left" valign="top" width="10"><span style="color:red;">*</span></td>
      <td width="27%" height="20" align="left" valign="top" class="classRowLabel"><strong>Negeri</strong></td>
      <td width="30" align="center" valign="top" class="classRowLabel"><span style="font-weight:bold">:</span></td>
      <td class="classRow"><select name="master_projek[negeri_id]" id="negeri_id" onchange="getAjaxParlimen();getAjaxDaerah();getAjaxPPD();">
        <?
				$combo   = new GUI();
				$options = getOptionsFromTable('ref_negeri','id','negeri');
				echo $combo->printCombo2($options, "pisang",true, "$institusi->negeri_id",false,0);
			  ?>
      </select></td>
    </tr>
    
    <tr>
      <td class="classRowLabel" align="left" valign="top" width="10"><span style="color:red;">*</span></td>
      <td width="27%" height="20" align="left" valign="top" class="classRowLabel"><strong>Daerah</strong></td>
      <td width="30" align="center" valign="top" class="classRowLabel"><span style="font-weight:bold">:</span></td>
      <td class="classRow"><span id="select_daerah_span"><select name="master_projek[daerah_id]" id="daerah_id">
        <?
				$combo   = new GUI();
				$options = getOptionsFromTable('ref_daerah','kod_daerah','daerah');
				echo $combo->printCombo2($options, "",true, "$institusi->kod_daerah",false,0);
			  ?>
      </select></span></td>
    </tr>
    

    <tr>
      <td class="classRowLabel" align="left" valign="top" width="10"><span style="color:red;">*</span></td>
      <td width="27%" height="20" align="left" valign="top" class="classRowLabel"><strong>Kod Projek Portfolio </strong></td>
      <td width="30" align="center" valign="top" class="classRowLabel"><span style="font-weight:bold">:</span></td>
      <td class="classRow"><input name="master_projek[kod_projek_portfolio]" id="kod_projek_portfolio" value="<?=$institusi->kod_projek_portfolio?>" onblur="" onchange="" onfocus="" onselect="" maxlength="100" size="50" type="text" /></td>
    </tr>

    <tr>
      <td class="classRowLabel" align="left" valign="top">&nbsp;</td>
      <td height="20" align="left" valign="top" class="classRowLabel">&nbsp;</td>
      <td align="center" valign="top" class="classRowLabel">&nbsp;</td>
      <td class="classRow">&nbsp;</td>
    </tr>
    <tr>
      <td class="classRowLabel" align="left" valign="top" width="10"><span style="color:red;">*</span></td>
      <td width="27%" height="20" align="left" valign="top" class="classRowLabel"><strong>Kategori Projek </strong></td>
      <td width="30" align="center" valign="top" class="classRowLabel"><span style="font-weight:bold">:</span></td>
      <td class="classRow"><select name="master_projek[kategori_projek_id]" id="kategori_projek_id">
        <?
				$combo   = new GUI();
				$options = getOptionsFromTable('ref_agensi_pelaksana','id','agensi_pelaksana');
				echo $combo->printCombo2($options, "",true, "$institusi->agensi_pelaksana_id",false,0);
			  ?>
      </select></td>
    </tr>
    <tr>
      <td class="classRowLabel" align="left" valign="top" width="10"><span style="color:red;">*</span></td>
      <td width="27%" height="20" align="left" valign="top" class="classRowLabel"><strong>Peruntukan Projek </strong></td>
      <td width="30" align="center" valign="top" class="classRowLabel"><span style="font-weight:bold">:</span></td>
      <td class="classRow"><input name="master_projek[peruntukan]" id="peruntukan" value="<?=$institusi->peruntukan?>" onblur="" onchange="" onfocus="" onselect="" maxlength="100" size="50" type="text" />      </td>
    </tr>
    <tr>
      <td class="classRowLabel" align="left" valign="top" width="10"><span style="color:red;">*</span></td>
      <td width="27%" height="20" align="left" valign="top" class="classRowLabel"><strong>Kementerian</strong></td>
      <td width="30" align="center" valign="top" class="classRowLabel"><span style="font-weight:bold">:</span></td>
      <td class="classRow"><select name="master_projek[kementerian_id]" id="kementerian_id">
        <?
				$combo   = new GUI();
				$options = getOptionsFromTable('ref_lokasi','id','lokasi');
				echo $combo->printCombo2($options, "lokasi",true, "$institusi->lokasi_id",false,0);
			  ?>
      </select></td>
    </tr>
    <tr>
      <td class="classRowLabel" align="left" valign="top" width="10"><span style="color:red;">*</span></td>
      <td width="27%" height="20" align="left" valign="top" class="classRowLabel"><strong>Projek Jabatan </strong></td>
      <td width="30" align="center" valign="top" class="classRowLabel"><span style="font-weight:bold">:</span></td>
      <td class="classRow"><select name="master_projek[projek_jabatan_id]" id="projek_jabatan_id">
        <?
				$combo   = new GUI();
				$options = getOptionsFromTable('ref_lokasi','id','lokasi');
				echo $combo->printCombo2($options, "lokasi",true, "$institusi->lokasi_id",false,0);
			  ?>
      </select></td>
    </tr>
    <tr>
      <td class="classRowLabel" align="left" valign="top" width="10"><span style="color:red;">*</span></td>
      <td width="27%" height="20" align="left" valign="top" class="classRowLabel"><strong>Kaedah Perlaksanaan </strong></td>
      <td width="30" align="center" valign="top" class="classRowLabel"><span style="font-weight:bold">:</span></td>
      <td class="classRow"><select name="master_projek[kaedah_id]" id="kaedah_id">
        <?
				$combo   = new GUI();
				$options = getOptionsFromTable('ref_lokasi','id','lokasi');
				echo $combo->printCombo2($options, "lokasi",true, "$institusi->lokasi_id",false,0);
			  ?>
      </select></td>
    </tr>
    <tr>
      <td class="classRowLabel" align="left" valign="top" width="10"><span style="color:red;">*</span></td>
      <td width="27%" height="20" align="left" valign="top" class="classRowLabel"><strong>Status Sub </strong></td>
      <td width="30" align="center" valign="top" class="classRowLabel"><span style="font-weight:bold">:</span></td>
      <td class="classRow"><select name="master_projek[status_sub_id]" id="status_sub_id">
        <?
				$combo   = new GUI();
				$options = getOptionsFromTable('ref_lokasi','id','lokasi');
				echo $combo->printCombo2($options, "lokasi",true, "$institusi->lokasi_id",false,0);
			  ?>
      </select></td>
    </tr>
    <tr>
      <td class="classRowLabel" align="left" valign="top" width="10"><span style="color:red;">*</span></td>
      <td width="27%" height="20" align="left" valign="top" class="classRowLabel"><strong>Ketua Unit </strong></td>
      <td width="30" align="center" valign="top" class="classRowLabel"><span style="font-weight:bold">:</span></td>
      <td class="classRow"><select name="master_projek[ketua_unit_id]" id="ketua_unit_id">
        <?
				$combo   = new GUI();
				$options = getOptionsFromTable('ref_lokasi','id','lokasi');
				echo $combo->printCombo2($options, "lokasi",true, "$institusi->lokasi_id",false,0);
			  ?>
      </select></td>
    </tr>
    <tr>
      <td class="classRowLabel" align="left" valign="top" width="10"><span style="color:red;">*</span></td>
      <td width="27%" height="20" align="left" valign="top" class="classRowLabel"><strong>Ketua Pengurus Projek </strong></td>
      <td width="30" align="center" valign="top" class="classRowLabel"><span style="font-weight:bold">:</span></td>
      <td class="classRow"><select name="master_projek[pm_id]" id="pm_id">
        <?
				$combo   = new GUI();
				$options = getOptionsFromTable('ref_lokasi','id','lokasi');
				echo $combo->printCombo2($options, "lokasi",true, "$institusi->lokasi_id",false,0);
			  ?>
      </select></td>
    </tr>
    <tr>
      <td class="classRowLabel" align="left" valign="top" width="10"><span style="color:red;">*</span></td>
      <td width="27%" height="20" align="left" valign="top" class="classRowLabel"><strong>Pengurus Projek (Jurutera) </strong></td>
      <td width="30" align="center" valign="top" class="classRowLabel"><span style="font-weight:bold">:</span></td>
      <td class="classRow"><select name="master_projek[jurutera_id]" id="jurutera_id">
        <?
				$combo   = new GUI();
				$options = getOptionsFromTable('ref_lokasi','id','lokasi');
				echo $combo->printCombo2($options, "lokasi",true, "$institusi->lokasi_id",false,0);
			  ?>
      </select></td>
    </tr>
    <tr>
      <td class="classRowLabel" align="left" valign="top" width="10"><span style="color:red;">*</span></td>
      <td width="27%" height="20" align="left" valign="top" class="classRowLabel"><strong>Ketua Penolong Pengurus Projek (TA) </strong></td>
      <td width="30" align="center" valign="top" class="classRowLabel"><span style="font-weight:bold">:</span></td>
      <td class="classRow"><select name="master_projek[pen_teknikal_id]" id="pen_teknikal_id">
        <?
				$combo   = new GUI();
				$options = getOptionsFromTable('ref_lokasi','id','lokasi');
				echo $combo->printCombo2($options, "lokasi",true, "$institusi->lokasi_id",false,0);
			  ?>
      </select></td>
    </tr>
    <tr>
      <td class="classRowLabel" align="left" valign="top" width="10"><span style="color:red;">*</span></td>
      <td width="27%" height="20" align="left" valign="top" class="classRowLabel"><strong>Penolong Pengurus Projek (Juruteknik) </strong></td>
      <td width="30" align="center" valign="top" class="classRowLabel"><span style="font-weight:bold">:</span></td>
      <td class="classRow"><select name="master_projek[juruteknik_id]" id="juruteknik_id">
        <?
				$combo   = new GUI();
				$options = getOptionsFromTable('ref_lokasi','id','lokasi');
				echo $combo->printCombo2($options, "lokasi",true, "$institusi->lokasi_id",false,0);
			  ?>
      </select></td>
    </tr>
    <tr>
      <td class="classRowLabel" align="left" valign="top" width="10"><span style="color:red;">*</span></td>
      <td width="27%" height="20" align="left" valign="top" class="classRowLabel"><strong>Tarikh Assignment </strong></td>
      <td width="30" align="center" valign="top" class="classRowLabel"><span style="font-weight:bold">:</span></td>
      <td class="classRow"><input name="master_projek[tarikh_assignment]2" value="<?=dmy_date($institusi->tarikh_assignment)?>" onblur="" onchange="" onfocus="" onselect="" maxlength="" size="20" type="text" />
(dd-mm-yyyy) </td>
    </tr>
    <tr>
      <td class="classRowLabel" align="left" valign="top" width="10"><span style="color:red;">*</span></td>
      <td width="27%" height="20" align="left" valign="top" class="classRowLabel"><strong>No Fail </strong></td>
      <td width="30" align="center" valign="top" class="classRowLabel"><span style="font-weight:bold">:</span></td>
      <td class="classRow"><input name="master_projek[no_fail]" id="no_fail" value="<?=$institusi->nama?>" onblur="" onchange="" onfocus="" onselect="" maxlength="100" size="50" type="text" /></td>
    </tr>
    <tr>
      <td class="classRowLabel" align="left" valign="top" width="10"><span style="color:red;">*</span></td>
      <td width="27%" height="20" align="left" valign="top" class="classRowLabel"><strong>Pihak Rekabentuk (HODT) </strong></td>
      <td width="30" align="center" valign="top" class="classRowLabel"><span style="font-weight:bold">:</span></td>
      <td class="classRow"><select name="master_projek[hodt]" id="hodt">
        <?
				$combo   = new GUI();
				$options = getOptionsFromTable('ref_lokasi','id','lokasi');
				echo $combo->printCombo2($options, "lokasi",true, "$institusi->lokasi_id",false,0);
			  ?>
      </select></td>
    </tr>
    <tr>
      <td class="classRowLabel" align="left" valign="top" width="10"><span style="color:red;">*</span></td>
      <td width="27%" height="20" align="left" valign="top" class="classRowLabel"><strong>Kumpulan</strong></td>
      <td width="30" align="center" valign="top" class="classRowLabel"><span style="font-weight:bold">:</span></td>
      <td class="classRow"><select name="master_projek[kumpulan_id]" id="kumpulan_id">
        <?
				$combo   = new GUI();
				$options = getOptionsFromTable('ref_lokasi','id','lokasi');
				echo $combo->printCombo2($options, "lokasi",true, "$institusi->lokasi_id",false,0);
			  ?>
      </select></td>
    </tr>
    <tr>
      <td class="classRowLabel" align="left" valign="top" width="10"><span style="color:red;">*</span></td>
      <td width="27%" height="20" align="left" valign="top" class="classRowLabel"><strong>Lain-lain ** (Kumpulan) </strong></td>
      <td width="30" align="center" valign="top" class="classRowLabel"><span style="font-weight:bold">:</span></td>
      <td class="classRow"><input name="master_projek[kumpulan_lain]" id="kumpulan_lain" value="<?=$institusi->kumpulan_lain?>" onblur="" onchange="" onfocus="" onselect="" maxlength="100" size="50" type="text" /></td>
    </tr>
    <tr>
      <td class="classRowLabel" align="left" valign="top" width="10"><span style="color:red;">*</span></td>
      <td width="27%" height="20" align="left" valign="top" class="classRowLabel"><strong>Kemajuan Fizikal </strong></td>
      <td width="30" align="center" valign="top" class="classRowLabel"><span style="font-weight:bold">:</span></td>
      <td class="classRow"><select name="master_projek[kemajuan_fizikal]" id="kemajuan_fizikal">
        <?
				$combo   = new GUI();
				$options = getOptionsFromTable('ref_lokasi','id','lokasi');
				echo $combo->printCombo2($options, "lokasi",true, "$institusi->lokasi_id",false,0);
			  ?>
      </select></td>
    </tr>
    <tr>
      <td class="classRowLabel" align="left" valign="top" width="10"><span style="color:red;">*</span></td>
      <td width="27%" height="20" align="left" valign="top" class="classRowLabel"><strong>Peratus Kemajuan </strong></td>
      <td width="30" align="center" valign="top" class="classRowLabel"><span style="font-weight:bold">:</span></td>
      <td class="classRow"><input name="master_projek[peratus_kemajuan]" id="peratus_kemajuan" value="<?=$institusi->peratus_kemajuan?>" onblur="" onchange="" onfocus="" onselect="" maxlength="10" size="12" type="text" />
        %</td>
    </tr>
    
    
    <tr>
      <td align="left" class="classRow"></td>
      <td align="left" class="classRow"></td>
      <td align="center" class="classRow"></td>
      <td class="classRow">&nbsp;</td>
    </tr>
    <tr>
      <td width="10" align="left" class="classRow"></td>
      <td align="left" class="classRow"></td>
      <td width="30" align="center" class="classRow"></td>
      <td class="classRow"><span class="TableRowLeft">
        <!--input name="button2" type="submit" class="Button" onclick="" value="Simpan" style=" width:100px;" /-->
        <input name="button_simpan" type="submit" class="Button" onclick="" value="Simpan" style=" width:100px;" />
      </span><span class="TableRowLeft">
      <input name="button_simpan" type="submit" class="Button" onclick="" value="Simpan & Teruskan" style=" width:150px;" />
      </span><span class="TableRowLeft">
      <input name="button_simpan" type="button" class="Button" onclick="" value="Batal" style=" width:100px;" />
      </span></td>
    </tr>
  </tbody>
</table>

</fieldset>


<script>

function getAjaxPPD() {
	//$('select_ppd_span').innerHTML = "<font color=orange>Searching PPD...please wait</font>";
	ajax_department_request("ajax.php?act=ppds_of_negeri", "negeri_id="+$("negeri_id").value)
}

function ajax_department_request(url, data) {
    var myAjax = new Ajax.Request(
        url,
        {method: 'post', parameters: data, onComplete: ajax_department_response}
    );
}

function ajax_department_response(originalRequest) {
	if (originalRequest.responseText != 0) {
		var a = originalRequest.responseText.split("$$")
		var k = new Array(a.length)
		for (i=0; i<k.length; i++) {
			k[i] = a[i].split("=")
		}
		//alert(originalRequest.responseText)
		
		str  = "<select  id=\"kod_ppd\" name=\"master_projek[kod_ppd]\" class=\"px200\">\n";
		str += "<option value=\"\">Sila Pilih</option>\n"
		for (i=0; i<k.length; i++) {
			str += "<option value=\"" + k[i][1] + "\">" + k[i][0] + "</option>\n";
		}
		str += "</select>\n";
		$("select_ppd_span").innerHTML = str;
	}
	else {
		$('select_ppd_span').innerHTML = "<font color=orange>List not found</font>"
	}
}

function getAjaxDaerah() {
	//$('select_daerah_span').innerHTML = "<font color=orange>Searching Daerah...please wait</font>"
	ajax_daerah_request("ajax.php?act=daerahs_of_negeri", "negeri_id="+$("negeri_id").value)
}

function ajax_daerah_request(url, data) {
    var myAjax = new Ajax.Request(
        url,
        {method: 'post', parameters: data, onComplete: ajax_daerah_response}
    );
}

function ajax_daerah_response(originalRequest) {
	if (originalRequest.responseText != 0) {
		var a = originalRequest.responseText.split("$$")
		var k = new Array(a.length)
		for (i=0; i<k.length; i++) {
			k[i] = a[i].split("=")
		}
		//alert(originalRequest.responseText)
		
		str  = "<select  id=\"kod_daerah\" name=\"master_projek[kod_daerah]\" class=\"px200\">\n";
		str += "<option value=\"\">Sila Pilih</option>\n"
		for (i=0; i<k.length; i++) {
			str += "<option value=\"" + k[i][1] + "\">" + k[i][0] + "</option>\n";
		}
		str += "</select>\n";
		$("select_daerah_span").innerHTML = str;
	}
	else {
		$('select_daerah_span').innerHTML = "<font color=orange>List not found</font>"
	}
}


function getAjaxParlimen() {
	//$('select_parlimen_span').innerHTML = "<font color=orange>Searching Parlimen...please wait</font>"
	ajax_parlimen_request("ajax.php?act=parlimens_of_negeri", "negeri_id="+$("negeri_id").value)
}

function ajax_parlimen_request(url, data) {
    var myAjax = new Ajax.Request(
        url,
        {method: 'post', parameters: data, onComplete: ajax_parlimen_response}
    );
}

function ajax_parlimen_response(originalRequest) {
	if (originalRequest.responseText != 0) {
		var a = originalRequest.responseText.split("$$")
		var k = new Array(a.length)
		for (i=0; i<k.length; i++) {
			k[i] = a[i].split("=")
		}
		//alert(originalRequest.responseText)
		
		str  = "<select  id=\"parlimen_id\" name=\"master_projek[parlimen_id]\" class=\"px200\" onchange=\"getAjaxDun()\">\n";
		str += "<option value=\"\">Sila Pilih</option>\n"
		for (i=0; i<k.length; i++) {
			str += "<option value=\"" + k[i][1] + "\">" + k[i][0] + "</option>\n";
		}
		str += "</select>\n";
		$("select_parlimen_span").innerHTML = str;
	}
	else {
		$('select_parlimen_span').innerHTML = "<font color=orange>List not found</font>"
	}
}

function getAjaxDun() {
	//$('select_parlimen_span').innerHTML = "<font color=orange>Searching Parlimen...please wait</font>"
	ajax_dun_request("ajax.php?act=duns_of_parlimen", "parlimen_id="+$("parlimen_id").value)
}

function ajax_dun_request(url, data) {
    var myAjax = new Ajax.Request(
        url,
        {method: 'post', parameters: data, onComplete: ajax_dun_response}
    );
}

function ajax_dun_response(originalRequest) {
	if (originalRequest.responseText != 0) {
		var a = originalRequest.responseText.split("$$")
		var k = new Array(a.length)
		for (i=0; i<k.length; i++) {
			k[i] = a[i].split("=")
		}
		//alert(originalRequest.responseText)
		
		str  = "<select  id=\"dun_id\" name=\"master_projek[dun_id]\" class=\"px200\">\n";
		str += "<option value=\"\">Sila Pilih</option>\n"
		for (i=0; i<k.length; i++) {
			str += "<option value=\"" + k[i][1] + "\">" + k[i][0] + "</option>\n";
		}
		str += "</select>\n";
		$("select_dun_span").innerHTML = str;
	}
	else {
		$('select_dun_span').innerHTML = "<font color=orange>List not found</font>"
	}
}

</script>

<script>

function GoSubmit(df) {

	//if (!checkSelection(strRegExp,$('kod'),'Kod Institusi')) return false;
	if (!checkInput(/.*/,$('kod'),'Kod Institusi')) return false;
	if (!checkInput(/.*/,$('nama'),'Nama Institusi')) return false;
	return true;
	if (!checkInput(/.*/,$('alamat'),'Alamat Institusi')) return false;

	if (!checkSelection(strRegExp,$('agensi_pelaksana_id'),'Agensi Pelaksana')) return false;
	if (!checkSelection(strRegExp,$('negeri_id'),'Negeri')) return false;
	if (!checkSelection(strRegExp,$('lokasi_id'),'Lokasi')) return false;
	if (!checkSelection(strRegExp,$('kod_daerah'),'Daerah')) return false;

	if (!checkSelection(strRegExp,$('kod_ppd'),'PPD')) return false;
	if (!checkSelection(strRegExp,$('parlimen_id'),'Parlimen')) return false;
	if (!checkSelection(strRegExp,$('dun_id'),'DUN')) return false;
	if (!checkSelection(strRegExp,$('bahasa_penghantar_id'),'Bahasa Penghantar')) return false;
	if (!checkSelection(strRegExp,$('gred_institusi_id'),'Gred Insitusi')) return false;
	if (!checkSelection(strRegExp,$('jenis_institusi_id'),'Jenis Insitusi')) return false;
	if (!checkSelection(strRegExp,$('maklumat_oku_id'),'Maklumat OKU')) return false;

	//if (!checkInput(anythingRegExp,$('profile_name'),'Nama Penuh Pemohon')) return false;
	//if (!checkInput(anything,$('profile_fax'),'Nombor Fax')) return false;

	return true;
}

</script>
